package com.personal.website.lottery.web.service.impl;

import com.personal.website.lottery.web.dao.NoticeMapper;
import com.personal.website.lottery.web.model.Notice;
import com.personal.website.lottery.web.model.NoticeExample;
import com.personal.website.lottery.web.service.NoticeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Gavin on 2016/4/3.
 */
@Service("noticeService")
public class NoticeServiceImpl implements NoticeService {
    @Resource
    private NoticeMapper noticeMapper;
    public List<Notice> getNoticeList(int length) {
        NoticeExample example = new NoticeExample();
        example.setLimitLength(length);
        example.setOrderByClause("submit_time");
        return this.noticeMapper.selectByExample(example);
    }

    public Notice getNoticeById(int noticeId) {
        return this.noticeMapper.selectByPrimaryKey(noticeId);
    }
}
